package main

import (
	"log"
	"net"
	item "radish/pkg/shop/item/itemservice"

	"github.com/cloudwego/kitex/pkg/rpcinfo"
	server "github.com/cloudwego/kitex/server"
	etcd "github.com/kitex-contrib/registry-etcd"
)

func main() {
	r, err := etcd.NewEtcdRegistry([]string{"127.0.0.1:2379"})
	if err != nil {
		log.Println(err.Error())
	}
	addr, _ := net.ResolveTCPAddr("tcp", ":8010")
	svr := item.NewServer(new(ItemServiceImpl),
		server.WithServiceAddr(addr),
		server.WithServerBasicInfo(&rpcinfo.EndpointBasicInfo{ServiceName: "shop.item"}),
		server.WithRegistry(r))

	err = svr.Run()
	if err != nil {
		log.Println(err.Error())
	}
}
